Hp = [q_array.*r_array, ...
    0.5*1.29.*Va_array.^2.*p_array./V0./2, ...
    0.5*1.29.*Va_array.^2.*Da_array];

Cp = inv(Hp'*Hp)*Hp'*p_dot_array;

Cp_ref = [(Iyy-Izz)/Ixx; ...
        Cl_p*Sref*Span*Span/Ixx; ...
        Cl_Da*Sref*Span/Ixx];


Hq = [p_array.*r_array, ...
    0.5*1.29.*Va_array.^2, ...
    0.5*1.29.*Va_array.^2.*q_array./V0./2, ...
    0.5*1.29.*Va_array.^2.*Alpha_array, ...
    0.5*1.29.*Va_array.^2.*De_array, ...
    -DT_array];

Cq = inv(Hq'*Hq)*Hq'*q_dot_array;

Cq_ref = [(Izz-Ixx)/Iyy; ...
        Cm_0*Sref*Chord/Iyy; ...
        Cm_q*Sref*Chord*Chord/Iyy; ...
        Cm_Alpha*Sref*Chord/Iyy; ...
        Cm_De*Sref*Chord/Iyy; ...
        Mm_L];
[Cp';Cp_ref']
[Cq';Cq_ref']